import useRequest from "@/api/useRequest"
import {IPage} from "@/interface/modules/system";
export class taskinfoController {

  static getCommonProgressInfo(taskId:string): Promise<any>{
    return useRequest({
      url: "/commonTask/getCommonTaskProgress/"+taskId,
      method: "get",
    })
  }

  static getTaskInfoList (data:any ,pagination?: IPage): Promise<any>{
    return useRequest({
      url: "/commonTask/list",
      method: "post",
      params: pagination,
      data
    })
  }


  static getTaskType(): Promise<any>{
    return useRequest({
      url: "/commonTask/getTaskType",
      method: "get",
    })
  }

  static getStoryTaskInfo(storyId:string): Promise<any>{
    return useRequest({
      url: "/commonTask/getStoryTaskInfo?storyId="+storyId,
      method: "get",
    })
  }


  static terminalTask(data:any): Promise<any>{
    return useRequest({
      url: "/commonTask/terminalTask",
      method: "post",
      data
    })
  }

  static batchTerminalTask(data:any): Promise<any>{
    return useRequest({
      url: "/commonTask/batchTerminalTask",
      method: "post",
      data
    })
  }

  static getUnfinishedTask(storyId:string):Promise<any>{
    return useRequest({
      url: "/commonTask/getUnFinishTaskInfo?storyId="+storyId,
      method: "get"
    })
  }


  static killStoryTask(storyId:string,taskId:string): Promise<any>{
    return useRequest({
      url: "/commonTask/kill/"+storyId+"/"+taskId,
      method: "get"
    })
  }

  static batchKillStoryTask(param): Promise<any>{
    return useRequest({
      url: "/commonTask/batchKillTask",
      method: "post",
      data:param
    })
  }

  static pauseStoryTask(storyId:string): Promise<any>{
    return useRequest({
      url: "/commonTask/pause/"+storyId,
      method: "get"
    })
  }

  static resumeStoryTask(storyId:string): Promise<any>{
    return useRequest({
      url: "/commonTask/resume/"+storyId,
      method: "get"
    })
  }

  static getPauseStatus(storyId:string): Promise<any>{
    return useRequest({
      url: "/commonTask/getPauseStatus/"+storyId,
      method: "get"
    })
  }
}
